/*******************************************************************************
 * Copyright (c) 2012 laurent barbisan.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    laurent barbisan - initial API and implementation
 *******************************************************************************/

package fr.free.hd.servers.android.geonaute.connector.model;

import java.util.ArrayList;

public class Track {

    public Integer Year = 0;
    public Integer Month = 0;
    public Integer Day = 0;
    public Integer Hour = 0;
    public Integer Min = 0;
    public Integer Sec = 0;
    public Integer Laps = 0;
    public Integer Duration_msec = 0;
    public Integer Duration_h = 0;
    public Integer Duration_m = 0;
    public Integer Duration_s = 0;
    public Integer Distance = 0;
    public Integer Calories = 0;
    public Double TopSpeed = 0.00;
    public Double AvgSpeed = 0.00;
    public Integer TopHeartBeat = 0;
    public Integer AvgHeartBeat = 0;
    public Integer AscHeight = 0;
    public Integer DescHeight = 0;
    public Integer Points = 0;
    public Integer ID = 0;
    public ArrayList<TrackLap> tls = new ArrayList<TrackLap>();
    public ArrayList<TrackPoint> tps = new ArrayList<TrackPoint>();

    @Override
    public String toString() {
        String year = Year.toString();
        String month = Month.toString();
        if (month.length() < 2) {
            month = "0" + month;
        }
        String day = Day.toString();
        if (day.length() < 2) {
            day = "0" + day;
        }
        String hour = Hour.toString();
        if (hour.length() < 2) {
            hour = "0" + hour;
        }
        String min = Min.toString();
        if (min.length() < 2) {
            min = "0" + min;
        }
        String sec = Sec.toString();
        if (sec.length() < 2) {
            sec = "0" + sec;
        }

        return "Track: " + year + "-"
                + month + "-"
                + day + " "
                + hour + ":"
                + min + ":"
                + sec;
    }

    public String getTrackTimeString() {
        String hour = Hour.toString();
        if (hour.length() < 2) {
            hour = "0" + hour;
        }
        String min = Min.toString();
        if (min.length() < 2) {
            min = "0" + min;
        }
        String sec = Sec.toString();
        if (sec.length() < 2) {
            sec = "0" + sec;
        }

        return hour + ":"
                + min + ":"
                + sec;
    }

    public String getTrackDurationString() {
        String hour = Duration_h.toString();
        if (hour.length() < 2) {
            hour = "0" + hour;
        }
        String min = Duration_m.toString();
        if (min.length() < 2) {
            min = "0" + min;
        }
        String sec = Duration_s.toString();
        if (sec.length() < 2) {
            sec = "0" + sec;
        }

        return hour + ":"
                + min + ":"
                + sec;
    }
}
